package com.gjs.management.service.Impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gjs.management.mapper.SysPermissionMapper;
import com.gjs.management.pojo.dto.permission.SysPermissionQueryDTO;
import com.gjs.management.pojo.entity.SysPermission;
import com.gjs.management.service.ISysPermissionService;
import org.springframework.stereotype.Service;

@Service
public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission> implements ISysPermissionService {
    @Override
    public Wrapper<SysPermission> buildWrapper(SysPermissionQueryDTO queryDTO){
        LambdaQueryWrapper<SysPermission> wrapper = new LambdaQueryWrapper<>();

        wrapper.eq(queryDTO.getId() != null && queryDTO.getId() > 0,SysPermission::getId,queryDTO.getId());
        wrapper.eq(queryDTO.getPid() != null,SysPermission::getPid,queryDTO.getPid());

        return wrapper;
    }
}
